home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / clang / cuj0593.zip / 1105028B < prev    next >
Text File  |  1993-05-16  |  1KB  |  47 lines

  1. // File: t001.tst
  2. // Tests for Invoice::totalDiscount()
  3. {
  4. #include "testgen.h"
  5. #include "invoice.h"
  6. }
  7. // set declarations
  8. Client someClient {
  9.   [Client(RETAIL)]
  10.   [Client(WHOLESALE)]
  11.   [Client(FOREIGN)]
  12. }
  13. int numItems {[1] [0] [4] }
  14. Item someItem otherItem {
  15.   [Item(100, 10, 1.00)]
  16.   [Item(1100, 5, 5.00)]
  17. }
  18. Invoice theInvoice { [Invoice(&someClient)] }
  19. // test run declarations
  20. runtest "r1" combining someClient
  21.              theInvoice numItems someItem
  22. {
  23.    cout << "TESTING CLIENTS & NO. OF ITEMS\n";
  24.    cout << "client: " << someClient << "\n";
  25.    cout << "items are:\n";
  26.    for (int i = 0; i < numItems; i++) {
  27.      theInvoice.addItem(&someItem);
  28.      cout << " " << someItem << "\n";
  29.    }
  30.    cout << "total discount: "
  31.         << theInvoice.totalDiscount() << "\n";
  32. }
  33.  
  34. runtest "r2" combining someClient
  35.              theInvoice someItem otherItem
  36. {
  37.    cout << "TESTING MIXING ITEMS\n";
  38.    cout << "client: " << someClient << "\n";
  39.    cout << "items are:\n";
  40.    theInvoice.addItem(&someItem);
  41.    cout << " " << someItem << "\n";
  42.    theInvoice.addItem(&otherItem);
  43.    cout << " " << otherItem << "\n";
  44.    cout << "total discount: "
  45.         << theInvoice.totalDiscount() << "\n";
  46. }
  47.